<?php

/**
 * Create account form.
 *
 * @package    form
 * @subpackage user
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class AccountCreateForm extends BaseUserForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'email'      => new sfWidgetFormInput(),
      'username'   => new sfWidgetFormInput(),
      'password'   => new sfWidgetFormInput(),
      'repeat'   => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorPropelChoice(array('model' => 'User', 'column' => 'id', 'required' => false)),
      'email'      => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'username'   => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'password'   => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'repeat'   => new sfValidatorString(array('max_length' => 40, 'required' => false)),
    ));
    
    $this->widgetSchema->setNameFormat('user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    
    $decorator = new myWidgetFormSchemaFormatterDl($this->widgetSchema);
    $this->widgetSchema->addFormFormatter('dl', $decorator); 
    $this->widgetSchema->setFormFormatterName('dl');   
  }
}
